package com.micromall.repository;

import com.github.pagehelper.Page;
import com.micromall.repository.entity.Goods;
import com.micromall.repository.entity.admin.AdminGoods;
import com.micromall.repository.entity.admin.AdminGoodsList;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Repository
public interface GoodsMapper extends BaseMapper<Goods> {

	Goods selectFullByPrimaryKey(int goodsId);

	Page<AdminGoodsList> selectAdminPage(Map<String, Object> params, RowBounds rowBounds);

	AdminGoods selectAdminDetails(int id);

	@Select("select count(*) from category where id=#{id}")
	@ResultType(Integer.class)
	int hasCategory(@Param("id") int id);
}